{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## OvR&OvO"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import datasets\n",
    "iris = datasets.load_iris()\n",
    "X = iris.data[:,:2]           #只使用前两个特征\n",
    "y = iris.target"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=666)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n",
       "                   intercept_scaling=1, l1_ratio=None, max_iter=100,\n",
       "                   multi_class='auto', n_jobs=None, penalty='l2',\n",
       "                   random_state=None, solver='lbfgs', tol=0.0001, verbose=0,\n",
       "                   warm_start=False)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LogisticRegression\n",
    "log_reg = LogisticRegression()\n",
    "log_reg.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7894736842105263"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_decision_boundary(model, axis):\n",
    "    \n",
    "    x0, x1 = np.meshgrid(\n",
    "        np.linspace(axis[0], axis[1], int((axis[1]-axis[0])*100)).reshape(-1, 1),\n",
    "        np.linspace(axis[2], axis[3], int((axis[3]-axis[2])*100)).reshape(-1, 1),\n",
    "    )\n",
    "    X_new = np.c_[x0.ravel(), x1.ravel()]\n",
    "\n",
    "    y_predict = model.predict(X_new)\n",
    "    zz = y_predict.reshape(x0.shape)\n",
    "\n",
    "    from matplotlib.colors import ListedColormap\n",
    "    custom_cmap = ListedColormap(['#EF9A9A','#FFF59D','#90CAF9'])\n",
    "    \n",
    "    plt.contourf(x0, x1, zz, cmap=custom_cmap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x4410a86888>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3df5BcdZnv8fczMyEZJpMMyI9AAgYLVCACkVQukruWC5QlgQKuwMotdGVLl9Vd3LjurnVZLEBKirK85ZqVLRX0XlH2+oPABZRgoRe4ArlAJfyGQReXHwlkCAJJJiGBTPq5f3T3ZKbTfU53n/72OafP51WVYvr86meayZMz53z6aXN3RESk9/WlXYCIiHSHGr6ISEGo4YuIFIQavohIQajhi4gUhBq+iEhBNN3wzazfzB41s1/WWXeRmb1mZo9V/ny2s2WKiEhSAy1suwIYBeY0WP8zd78keUkiIhJCU2f4ZrYAOAP4fthyREQklGbP8L8FfBkYjtjmXDP7MPB74O/cfX3tBmZ2MXAxwNDMmSceNW9ei+WK9K7XB9+VdgmSA+uffeSP7n5gO/vGNnwzOxPY5O7rzOwjDTb7BfATd3/bzD4H3ACcUruRu18HXAeweOFCv+eyy9qpWaQn3XDCp9MuQXLgi0tnvtjuvs1c0lkGnGVmLwA/BU4xsxunbuDur7v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bGu36eZrFVtTCq9T1enAI+7+ap11qfxMRdWU0ut0GvC8u7/m7ruAW4CTa7bpdp+KramdPhW04bv7pe6+wN0XUv4V7m53r/1X6nbg05Wvz6tsE+xfzmZqqrmOeRYwGqqeyvMNmdlw9Wvgo0DtJNHbgT+vJCtOovwr3sa067Iuj9Zw9zFgvZlVJwaeCjxTs1lXX6tmaur26zTFf6XxpZOu/0zF1ZTS6/QScJKZ7Vt57lPZ++98V/tUMzW11adC3mmuuaP8ESp334GrgLMqX8+i/Kvdc8DDwHsyUNM1wNPA48A9wPsD1/GeynM9XnneyyrLPwd8rvK1Af8K/AF4EljShdenmboumfJaPQic3IW6TgDWAk9Q/pV/vwy8VnE1pfE67Uu5Wc6dsizt1ymupq6/TpXn/SrwLOUTmh8DM9PuU03U1HKf0mgFEZGC0DttRUQKQg1fRKQg1PBFRApCDV9EpCDU8EVECkINX0SkINTwRUQK4v8D0WeUpepfh5UAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(log_reg, axis=[4, 8.5, 1.5, 4.5])\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.scatter(X[y==2,0], X[y==2,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7894736842105263"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg2 = LogisticRegression(multi_class=\"multinomial\", solver=\"newton-cg\")\n",
    "log_reg2.fit(X_train, y_train)\n",
    "log_reg2.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x44109c2f08>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3dfZBcdZ3v8fd3ZkIyTiYZkIdAAoIFKpJFIqlclty1XKQsCRRwBVZuoStbu8u6u7px3Ye6LBYiJUVZ3nLNypaKeq8oe30gcAElWOoFrkguUAnPOKzLLg8JZAgCSSYhgUz6e//o7slMp/uc7j79Ow99Pq+qFNPnqb/TTL45c86nv23ujoiI9L+BrAsQEZF0qOGLiJSEGr6ISEmo4YuIlIQavohISajhi4iURNsN38wGzexhM/tJk3WXmtnLZvZI7c+f9LZMERFJaqiDbVcD48CCFut/6O6fTF6SiIiE0NYZvpktAc4GvhW2HBERCaXdM/yvAH8PjEZsc4GZvQ/4DfDX7r6pcQMzuwy4DGBk7txTT1i0qMNyRfrXK8NvzboEKYBNTz30W3c/rJt9Yxu+mZ0DbHX3jWb2/hab/Rj4vru/YWafAG4AzmjcyN2vB64HWHbssX73FVd0U7NIX7rhlI9nXYIUwKdXzH2u233buaSzEjjXzJ4FfgCcYWY3ztzA3V9x9zdqD78JnNptQSJlpGYvaYht+O5+ubsvcfdjgYuBu9z9ozO3MbMjZzw8l+rNXRFpw9glg1mXICXRSUpnFjO7Gtjg7rcDf2Vm5wJTwKvApb0pT6S/jV0yyJonPxq/oUgPdNTw3f0e4J7a11fOWH45cHkvC5P+s25ymK++OsrE1CCLhvbxqUMmWTW6O+uyMqNmL2nr+gxfpBPrJoe5+uWF7PHqVcQtU0Nc/fJCgNI2fTV7SZtGK0gqvvrq6HSzr9vjA3z11aikb//STVrJghq+pGJiqvmNyVbLRaT31PAlFYuG9n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vtuR6tPe8VteWfAD5R+9qAfwb+HXgcWJ7C69NOXZ+c8VrdD5yeQl2nABuAx6j+yn9wDl6ruJqyeJ3eQrVZLpyxLOvXKa6m1F+n2vN+HniK6gnN94C5WfepNmrquE9ptIKISEnonbYiIiWhhi8iUhJq+CIiJaGGLyJSEmr4IiIloYYvIlISavgiIiXx/wFT3ZM5uvxUWAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(log_reg2, axis=[4, 8.5, 1.5, 4.5])\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.scatter(X[y==2,0], X[y==2,1])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 用所有特征"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = iris.data\n",
    "y = iris.target\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=666)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg = LogisticRegression()\n",
    "log_reg.fit(X_train, y_train)\n",
    "log_reg.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
